Maths trick for fast calculations